package model

import "fmt"

type Task interface {
   Call() interface{}
   SetTemplate()
   SendResult()
   Params() interface{}

}

type BaseInfo struct {
   TaskId string

}

type WriteTask interface {
   Task
   Execute(param string)
}

type BaseWriteTask struct {
   BaseInfo
}

func (wt BaseWriteTask) Call() (r interface{}) {

   fmt.Println("this is write task"+wt.TaskId)
   r = "writing .... "
   return
}

func (wt BaseWriteTask) Execute(param string){

   fmt.Println("this is write task")

}

func (wt BaseWriteTask) SetTemplate() {

   fmt.Println("this is write task")

}

func (wt BaseWriteTask) SendResult() {

fmt.Println("this is write task")

}


func (wt BaseWriteTask) Params() (r interface{}){

   fmt.Println("this is write task")
   r = "writing .... "
   return
}


type BaseReadTask struct {
   BaseInfo
}

func (rt BaseReadTask) Call() (r interface{}) {

   fmt.Println("this is read task"+rt.TaskId)
   r = "reading .... "
   return
}

func (rt BaseReadTask) Execute(param string){

   fmt.Println("this is read task")

}

func (rt BaseReadTask) SetTemplate() {

   fmt.Println("this is read task")

}

func (rt BaseReadTask) SendResult() {

   fmt.Println("this is read task")

}


func (rt BaseReadTask) Params() (r interface{}){

   fmt.Println("this is read task")
   r = "reading .... "
   return
}


